<template>
  <div id="app" :class="{ 'theme-dark': isDark, 'theme-light': !isDark }">
   
    <router-view/>
  </div>
</template>

<script>
import { mapState } from 'vuex'

export default {
  name: 'App',
  computed: {
    ...mapState('theme', ['isDark'])
  }
}
</script>

<style lang="scss">

@import '@/styles/variables.scss';

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  @include themed() {
    background-color: t('bg-color');
    color: t('text-color');
  }
}

#app {
  height: 100%;
  @include themed() {
    background-color: t('bg-color');
    color: t('text-color');
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  @include themed() {
    background: t('border-color');
  }
  border-radius: 3px;
}

::-webkit-scrollbar-track {
  @include themed() {
    background: t('bg-color');
  }
}

/* Element UI 主题覆盖 */
.el-card {
  @include themed() {
    background: t('card-bg-color');
    border: 1px solid t('border-color');
    color: t('text-color');
  }
}

.el-card__header {
  @include themed() {
    border-bottom: 1px solid t('border-color');
  }
  padding: 15px 20px;
}

.el-table {
  @include themed() {
    background: t('card-bg-color');
    color: t('text-color');
  }
}

.el-table th {
  @include themed() {
    background: t('bg-color');
    color: t('text-color');
    border-bottom: 1px solid t('border-color');
  }
}

.el-table td {
  @include themed() {
    border-bottom: 1px solid t('border-color');
  }
}

.el-table--striped .el-table__body tr.el-table__row--striped td {
  @include themed() {
    background: t('bg-color');
  }
}

.el-table--enable-row-hover .el-table__body tr:hover > td {
  @include themed() {
    background: t('border-color');
  }
}

.el-pagination {
  padding: 20px 0;
  text-align: right;
}

.el-pagination button {
  @include themed() {
    background: t('card-bg-color');
    border: 1px solid t('border-color');
    color: t('text-color');
  }
}

.el-pagination .el-pager li {
  @include themed() {
    background: t('card-bg-color');
    border: 1px solid t('border-color');
    color: t('text-color');
  }
}

.el-pagination .el-pager li.active {
  @include themed() {
    background: t('primary-color');
    border-color: t('primary-color');
    color: #fff;
  }
}

.el-input__inner {
  @include themed() {
    background: t('bg-color');
    border: 1px solid t('border-color');
    color: t('text-color');
  }
}

.el-input__inner:focus {
  @include themed() {
    border-color: t('primary-color');
  }
}

.el-button {
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.3s;
}

.el-button--primary {
  @include themed() {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color-light) 100%);
    border: none;
    box-shadow: 0 2px 6px rgba(var(--primary-color-rgb), 0.2);
  }
}

.el-button--primary:hover {
  transform: translateY(-1px);
  @include themed() {
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3);
  }
}

.el-button--success {
  @include themed() {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-color-light) 100%);
    border: none;
    box-shadow: 0 2px 6px rgba(var(--success-color-rgb), 0.2);
  }
}

.el-button--success:hover {
  transform: translateY(-1px);
  @include themed() {
    box-shadow: 0 4px 12px rgba(var(--success-color-rgb), 0.3);
  }
}

.el-button--danger {
  @include themed() {
    background: linear-gradient(135deg, var(--danger-color) 0%, var(--danger-color-light) 100%);
    border: none;
    box-shadow: 0 2px 6px rgba(var(--danger-color-rgb), 0.2);
  }
}

.el-button--danger:hover {
  transform: translateY(-1px);
  @include themed() {
    box-shadow: 0 4px 12px rgba(var(--danger-color-rgb), 0.3);
  }
}

.el-dialog {
  @include themed() {
    background: t('card-bg-color');
    border: 1px solid t('border-color');
  }
}

.el-dialog__title {
  @include themed() {
    color: t('text-color');
  }
}

.el-dialog__header {
  @include themed() {
    border-bottom: 1px solid t('border-color');
  }
}

.el-dialog__body {
  @include themed() {
    color: t('text-color');
  }
}

.el-dialog__footer {
  @include themed() {
    border-top: 1px solid t('border-color');
  }
}

.el-form-item__label {
  @include themed() {
    color: t('text-color');
  }
}

.el-select-dropdown {
  @include themed() {
    background: t('card-bg-color');
    border: 1px solid t('border-color');
  }
}

.el-select-dropdown__item {
  @include themed() {
    color: t('text-color');
  }
}

.el-select-dropdown__item.hover,
.el-select-dropdown__item:hover {
  @include themed() {
    background: t('border-color');
    color: t('primary-color');
  }
}

.el-message {
  @include themed() {
    background: t('card-bg-color');
    border: 1px solid t('border-color');
    color: t('text-color');
  }
}

.el-message--success {
  @include themed() {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-color-light) 100%);
    border: none;
    color: #fff;
  }
}

.el-message--warning {
  @include themed() {
    background: linear-gradient(135deg, var(--warning-color) 0%, var(--warning-color-light) 100%);
    border: none;
    color: #fff;
  }
}

.el-message--error {
  @include themed() {
    background: linear-gradient(135deg, var(--danger-color) 0%, var(--danger-color-light) 100%);
    border: none;
    color: #fff;
  }
}
</style>
